BlueCielo Meridian Enterprise 2018 VBScript API Reference
VaultEvent_ChangeScope event
This event can be invoked by script to present the user with a list of scopes from which to choose. The scopes can be existing ones defined in the vault configuration or this procedure can define a temporary virtual scope based upon an existing one like a template.
Syntax
VaultEvent_ChangeView(ScopeName, Scope)
Name | Description |
---|---|
ScopeName |
A string that contains the name of an existing scope to set as the default for the user or the name of a virtual scope that the procedure will create based on an existing scope. No special characters except the underscore (_) that appear in the scope list shown to the user (for example, a hyphen) will be returned in this property name (the user selected scope). The procedure itself must parse and replace such characters. |
Scope |
The scope object set for the user by the procedure. Its value is Nothing when the procedure is first called. References to this object before it has been initialized by the procedure will produce the error Cannot initialize user session. |
Remarks
This procedure is intended to be used in vaults that contain many projects and by users who should be limited by scopes to only work on those projects to which they are assigned. Scopes defined in Meridian Configurator cannot be modified by this procedure. The virtual scopes defined by this procedure exist only within the current vault transaction. This procedure is not supported in PowerUser.
The DynamicScopes property used in this procedure is a one dimension array of the internal names of scopes to present to the user for selection. The names should not contain any spaces until after the scope has been defined, then its DisplayName property can be set and include spaces. The array replaces the normal list of scopes defined in the vault configuration. All scope names in this array must be handled by this procedure. If the user selects an unhandled virtual scope, no scope will be applied and errors can occur. No automatic security validation is performed, it is the responsibility of the procedure to do so, if required.
Example
Sub VaultEvent_ChangeScope(ScopeName,Scope) ' Set scope based on user name If (User.Name = "Benjamin") Then ' Create a scope based on an existing scope named Manager Set Scope = Vault.Scope("Manager") ' Give it the project name Scope.DisplayName = ScopeName ' Set its root folder based on the project name If (ScopeName = "Project123") Then Scope.RootFolder = "\West\Metropolis\123" ElseIf (ScopeName = "Project234") Then Scope.RootFolder = "\West\Metropolis\234" ElseIf (ScopeName = "Project345") Then Scope.RootFolder = "\West\Metropolis\345" Else ' Other projects use a default scope Set Scope = Vault.Scope(ScopeName) End If ' Show available scopes for Benjamin Scope.DynamicScopes = Array ("Project 123", "Project 234", "Project 345") Else ' Other users get the default scope Set Scope = Vault.Scope(ScopeName) End If End Sub